package com.kitty.game.hunqiao.model;

import com.kitty.game.equip.model.EquipField;
import com.kitty.game.equip.model.RoleHunQiField;
import com.kitty.mina.annotation.ListField;
import com.kitty.game.hunqiao.model.HunQiaoAllProps;

import java.util.ArrayList;
import java.util.List;

public class HunQiaoStoreEquipInfo {
    private byte index = 1;
    private short pos = 201;//仓库中的位置
    private short size;

    @ListField(2)
    private List<EquipField> equipFields;
    @ListField(2)
    private List<HunQiaoField> hunQiaoFields;

    public byte getIndex() {
        return index;
    }

    public void setIndex(byte index) {
        this.index = index;
    }

    public short getPos() {
        return pos;
    }

    public void setPos(short pos) {
        this.pos = pos;
    }

    public short getSize() {
        return (short) ((equipFields == null ? 0 : equipFields.size()) + (hunQiaoFields == null ? 0
                : hunQiaoFields.size()));
    }

    public void setSize(short size) {
        this.size = size;
    }

    public List<EquipField> getEquipFields() {
        if(equipFields==null){
            equipFields = new ArrayList<>();
        }
        setSize(getSize());
        return equipFields;
    }

    public void setEquipFields(List<EquipField> equipFields, List<HunQiaoField> hunQiFields) {
        this.equipFields = equipFields;
        this.hunQiaoFields = hunQiFields;
        setSize(getSize());
    }

    public List<HunQiaoField> getHunQiaoFields() {
        return hunQiaoFields;
    }

    public void setHunQiaoFields(List<HunQiaoField> hunQiaoFields) {
        this.hunQiaoFields = hunQiaoFields;
        setSize(getSize());
    }
}
